//
//  Text.m
//  ChampoinPeso
//
//  Created by mac on 2025/2/17.
//

#import "Text.h"
@interface Text()<UITextFieldDelegate>
@property (nonatomic,strong)UITextField *name;
@end
@implementation Text

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    UIView *view = [UIView new];
    view.backgroundColor  = UIColor.clearColor;
    [self addSubview:view];
    UIImageView *bg= [UIImageView new];
    bg.contentMode = UIViewContentModeScaleAspectFit;
    bg.image = [UIImage imageNamed:@"textBG"];
    [view addSubview:bg];
    [bg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_offset(0);
    }];
    UIImageView *icon = [UIImageView new];
    icon.image = [UIImage imageNamed:@"textBG"];
    [view addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-12);
        make.centerY.mas_equalTo(view);
    }];
}
-(UITextField *)name
{
    if (!_name) {
        _name = [UITextField new];
        _name.font = [UIFont systemFontOfSize:16];
        _name.delegate = self;
    }
    return _name;
}
@end
